function [ all, c, ax, vx  ] = vstko_MVDR_pokusy(xxx)

[samples,sr] = wavread(xxx);

win = 400; 
hopfactor = 0.4;
p = 22;
M = 24;
R = [ 0 sr/2 ];

samples = filter([1 -0.97], 1, samples);

hop = win*hopfactor;
Z = buffer(samples,win,win-hop);
Q = size(Z,2);
hamming_okno = hamming(win);
oknovane_ramce_all = [];
for q = 1:Q
    wind = Z(:,q);
    oknovane_ramce = hamming_okno.*wind;
    oknovane_ramce_all = [oknovane_ramce_all oknovane_ramce];
    X = oknovane_ramce_all;
end

NFFT = 2^nextpow2(length(X));
X = fft(X,NFFT);
%X_fft = (fft(X));
%wts = fft2barkmx(400, 16000, 400, 1, 0, 8000);
%XX = wts * X;

XX = audspec(X, 16000, 24, 'mel', 0, 8000, 1, 1);

%X = fft(X,win);

%XX = audspec_MVDR(X, sr);

%hz2mel = @(hz)(1127*log(1+hz/700));
%mel2hz = @(mel)(700*exp(mel/1127)-700);      
%[ H, f, c ] = trifbank( 400, win, R, sr, hz2mel, mel2hz );
%XX = (H * X);       
       
%X_mel = melbankm(M,win,sr);
%XX = X_mel*X(1:win/2+1,:);

%alpha = 0.42;
%[bhat, ahat]  = warppoles(X, alpha);  
%XX = X.*ahat;
       
Sa_all = [];
Sp_all = [];
Sb_all = [];

%R = real(ifft(XX));
for i = 1:Q,
    ramec_MVDR = XX(:,i);
    [Sa,Sb,Sp] = pmvdr_MVDR_presne(ramec_MVDR,p);
    Sa_all = [Sa_all Sa];
Sp_all = [Sp_all Sp];
Sb_all = [Sb_all Sb];    
end

mvdr_fft = (fft(Sb_all));
y = log(mvdr_fft);

%c = rdct(y);
c = real(ifft(abs(y).^2));

nbands = size(c,1);

c(14:nbands, :) = [];
for i = 1 : 13
           c(i, : ) = c(i, : ) - mean(c(i, : ));
end

c=c';

nf=size(c,1);
nc=13;

  vf=(4:-1:-4)/60;
  af=(1:-1:-1)/2;
  ww=ones(5,1);
  cx=[c(ww,:); c; c(nf*ww,:)];
  vx=reshape(filter(vf,1,cx(:)),nf+10,nc);
  vx(1:8,:)=[];
  ax=reshape(filter(af,1,vx(:)),nf+2,nc);
  ax(1:2,:)=[];
  vx([1 nf+2],:)=[];  
  all=[c vx ax];
  
  c=c';             %zakladne
  ax=ax';           %akceleracne
  vx=vx';           %diferencne
  all=all';         %vsetky 39
  
   subplot(411)
   
 c_idct       = idct(c, 24);

 str_hod = mean(c_idct(:));
 smer_odch  = std(c_idct(:));

 far_skala_1 = 35 - str_hod;
 far_skala_2 = 10 / smer_odch;

 image(far_skala_2 * c_idct + far_skala_1);
 axis xy
 
 subplot(412)
 
 imagesc(c);
 axis xy
 
 


end
